package com.richie696.account.controller;

import com.richie696.account.json.ExecuteResult;
import com.richie696.account.model.AccountRequestModel;
import com.richie696.account.model.AccountResponseModel;
import com.richie696.account.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
public class AccountController {

    private final AccountService accountService;

    @Autowired
    public AccountController(AccountService accountService) {
        this.accountService = accountService;
    }

    @PostMapping("/transfer")
    @ResponseBody
    public ExecuteResult<AccountResponseModel> doTransfer(@RequestBody AccountRequestModel model) {
        return accountService.doTransferProcess(model);
    }

}
